package com.cortex.papaya.search;

import java.net.Socket;
import java.util.ArrayList;
import java.util.List;

import org.carrot2.core.Cluster;
import org.carrot2.core.Document;
import org.carrot2.source.SearchEngineResponse;
import com.cortex.papaya.utilities.MyLog;

import android.graphics.Bitmap;
import android.os.AsyncTask;
import android.util.Log;
import android.widget.ImageView;
import android.widget.TextView;

public class Category {
	private Cluster cluster;
	private List<Link> links;
	private int color;
	private boolean isIconsInclued = false;
	private String name;
	
	public Category(String name,Cluster cluster,List<Link> links) {
		this.cluster = cluster;
		this.links = links;
		color = Categories.getRandomResourceColor();
		this.name = name;
	}
	public List<Link> getLinks() {
		return links;
	}
	public void setLinks(List<Link> links) {
		this.links = links;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}

	public double getSocre() {
		return cluster.getScore();
	}
	public int getCountLinks(){
		return links.size();
	}
	public int getColor() {
		return color;
	}
	public boolean isIconsInclued() {
		return isIconsInclued;
	}
	public void setIconsInclued(boolean isIconsInclued) {
		this.isIconsInclued = isIconsInclued;
	}
	public boolean contains(Link document){
		for (Link doc : getLinks()) {
			if(document.equals(doc)){
				return true;
			}
		}
		return false;
	}
	public Link getLink(int id) {
		for (Link document : links) {
			if(document.getId() == id){
				return document;
			}
		}
		return null;
	}
	
}